import openai
import time
openai.api_key = "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"
def generate_response(prompt):
    response = openai.Completion.create(
        engine="text-davinci-003",
        prompt=prompt,
        max_tokens=2000,
        n=1,
        stop=None,
        temperature=0.5,
    )
    message = response.choices[0].text.strip()
    return message
while True:
    prompt = input("You: ")
    if prompt.lower() in ["bye", "goodbye"]:
        print("Bot: Goodbye!")
        break
    message = generate_response(prompt)
    print("Bot:", message)
    time.sleep(1)